import request from "@/utils/request";

//  报工单列表
export function getReportList(data) {
  return request({
    url: "/report/list",
    method: "post",
    data,
  });
}


export function getReportDetail(data) {
  return request({
    url: "/report/getReportDetail",
    method: "get",
    params: data,
  });
}

export function getReportDetailByRealityLing(data) {
  return request({
    url: "/report/getReportDetailByRealityLing",
    method: "get",
    params: data,
  });
}

export function getMachineAndPieceByTechnology(data){
  return request({
    url: "/produce/getMachineAndPieceByTechnology",
    method: "get",
    params: data,
  });
}

//  报工单新增
export function addReportList(data) {
  return request({
    url: "/report/add",
    method: "post",
    data,
  });
}
//  报工单获取详情
export function getReportById(data) {
  return request({
    url: "/report/getById",
    method: "post",
    data,
  });
}
//  修改
export function reportEdit(data) {
  return request({
    url: "/report/edit",
    method: "post",
    data,
  });
}
// 报工单删除
export function delReportById(data) {
  return request({
    url: "/report/deleteById",
    method: "post",
    data,
  });
}
//  报工单修改状态
export function updateStatus(data) {
  return request({
    url: "/report/updateStatus",
    method: "post",
    data,
  });
}
//  获取保报工保养记录
export function listReportCare(query) {
  return request({
    url: '/mes/caredetail/reportcarelist',
    method: 'get',
    params: query
  })
}

//获取机台出库库存
export function getMachineOutboundInfo(data) {
  return request({
    url: '/MesCuttingOutbound/getMachineOutboundInfo',
    method: 'get',
    params: data
  })
}


//导出报工明细
export function exportReportDetail(data) {
  return request({
      url: `/report/exportReportDetail`,
      method: 'post',
      data,
      responseType: 'blob',
  })
}


//导出累计报工明细
export function exportReportRealityLing(data) {
  return request({
      url: `/report/exportReportRealityLing`,
      method: 'post',
      data,
      responseType: 'blob',
  })
}

// 传入参数：
// 机台编号：machineNo
// 保养明细状态：status = 2 ，取保养记录状态字典中 已执行的